<?php
	include_once('../sys/sys.php');
	include_once('./gfun.php');
	include_once('./funcs.php');
	header('Content-Type: text/html; charset=utf-8');
	
	$action = $_GET['action'];
	//$accc = array();
	
	if ($action == 'elsesky'){
		//获取所有在下载中没连接的应用ID
		$row = $DB->build_query(array(
				'select' 	=> 'id,name',
				'from'		=> 'gfunapps',
// 				'where'		=>	"supportedos='null'",
		));
		$qid = $DB->exec_query();
		while ($row = $DB->fetch_row($qid)) {
			$appid = $row['id'];
			$where = 'AND appid= ' . $appid .'';
			//echo $where;exit;
			$result = $DB->build_and_exec_query(
					array('select' => 'COUNT(*) as max','from'   => 'gfunappds','where'	=> "1 " . $where ,)
			);
			//当已经存在的时候跳过插入
			if ($result['max'] > 0) {
				continue;
			}
			//$accc[] = $result;
			
			//重新采集该ID
			get_single_app($DB,$gfun_app_pre,$appid);
			echo '应用<B><font color="red">'  . $row['name'] . "</font></B>重采集完毕<BR>";
			ob_flush();
		}
	}
	//print_r($accc);
	exit;
	
	
	
	
?>